package com.cn.serverline.lineicp.productionLine.enums;

import cn.stylefeng.roses.kernel.rule.exception.base.ServiceException;
import lombok.Getter;

/**
 * 产品结构类型枚举
 *
 * @author Gmr
 * @since 2024/7/30
 */
@Getter
public enum ProductMixCategoryEnum {

	LARGE_CATEGORY(0L, "大类"),
	SECONDARY_CATEGORY(1L, "二级类"),
	MODEL(2L,"型号"),
	PROCESS_SCHEME(3L,"工艺方案");

	private final Long code;
	private final String message;

	ProductMixCategoryEnum(Long code, String message) {
		this.code = code;
		this.message = message;
	}

	public static void validate(Long code) {
		for (ProductMixCategoryEnum value : ProductMixCategoryEnum.values()) {
			if (value.getCode().equals(code)) {
				return;
			}
		}
		throw new ServiceException(ProductMixException.UNKNOWN_PRODUCT_STRUCTURE_TYPE);
	}
}
